package com.class5;
import java.sql.*;
public class MysqlTest {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        Class.forName("com.mysql.jdbc.Driver");
        Connection connection=DriverManager.getConnection("jdbc:mysql://192.168.153.136:3306/tpshop2.0?"+"useSSL=false&useUnicode=true&characterEncoding=utf-8","root","123456");
        Statement statement=connection.createStatement();
        //得到结果集，需要进行处理
        ResultSet resultSet=statement.executeQuery("select * from tp_shopgoods where goods_name like '佐露絲%'");
        System.out.println(resultSet);
        ResultSetMetaData metaData=resultSet.getMetaData();
        while(resultSet.next()){
            for(int i=0;i<metaData.getColumnCount();i++){
                System.out.println(metaData.getCatalogName(i+1)+"的值是"+resultSet.getString(i+1));
            }
        }
    }
}
